package cn.itcast.aop.synthesize;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class MyAspect {
    //附加功能，被称为通知，通知所在的类称为切面类
    @Before("execution(public void cn.itcast.aop.synthesize.Target.save())")
    public void startTransactional(){
        System.out.println("开启事物");
    }
    @After("execution(public void cn.itcast.aop.synthesize.Target.save())")
    public void submitTransactional(){
        System.out.println("提交事物");
    }
}
